/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author FIRE
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface ShopNotice extends BasicModel<ShopNotice> {
  ctype?: string; // 公告类型
  ctitle?: string; // 标题
  simpleContent?: string; // 内容简介
  content?: string; // 内容详情
  picUrl?: string; // 封面图地址
  bappShow?: string; // APP发布
  fbDate?: string; // 发布日期
}

export const shopNoticeList = (params?: ShopNotice | any) =>
  defHttp.get<ShopNotice>({ url: adminPath + '/shop/notice/shopNotice/list', params });

export const shopNoticeListData = (params?: ShopNotice | any) =>
  defHttp.post<Page<ShopNotice>>({ url: adminPath + '/shop/notice/shopNotice/listData', params });

export const shopNoticeForm = (params?: ShopNotice | any) =>
  defHttp.get<ShopNotice>({ url: adminPath + '/shop/notice/shopNotice/form', params });

export const shopNoticeSave = (params?: any, data?: ShopNotice | any) =>
  defHttp.postJson<ShopNotice>({ url: adminPath + '/shop/notice/shopNotice/save', params, data });

export const shopNoticeDisable = (params?: ShopNotice | any) =>
  defHttp.get<ShopNotice>({ url: adminPath + '/shop/notice/shopNotice/disable', params });

export const shopNoticeEnable = (params?: ShopNotice | any) =>
  defHttp.get<ShopNotice>({ url: adminPath + '/shop/notice/shopNotice/enable', params });

export const shopNoticeDelete = (params?: ShopNotice | any) =>
  defHttp.get<ShopNotice>({ url: adminPath + '/shop/notice/shopNotice/delete', params });

export const openNotice = (params?: any, data?: ShopNotice | any) =>
  defHttp.postJson<ShopNotice>({
    url: adminPath + '/shop/notice/shopNotice/openNotice',
    params,
    data,
  });

export const offNotice = (params?: any, data?: ShopNotice | any) =>
  defHttp.postJson<ShopNotice>({
    url: adminPath + '/shop/notice/shopNotice/offNotice',
    params,
    data,
  });
